<template>
  <div>
    <!--文章列表-->
    <div class="article-list">
      <row type="flex" justify="space-around" class="code-row-bg">
        <i-col span="11">
          <article-list :list="list" :title="listTitle"></article-list>
        </i-col>
      </row>
    </div>
  </div>
</template>

<script>
import ArticleList from '../components/ArticleList'

export default {
  name: 'allArticles',
  components: {
    ArticleList
  },
  data() {
    return {
      value2: 0,
      list: [],
      listTitle: '最新文章',
    }
  },
  created: function () {

    //获取所有文章
    this.$api.get('getNewArticle').then((res) => {
      console.log(res);
      let rData = res.data.slice(0, 5)
      let tData = []
      rData.map((item) => {
        if (item.id !== 0) {
          tData.push(item)
        }
      })
      this.list = tData
    })
  }
}
</script>
<style>

.article-list{
  padding: 20px 0 20px 0;
}
</style>